package router

import (
	"article_vote/controller"
	"github.com/gin-gonic/gin"
)

func WebRoute(router *gin.Engine)  {
	router.GET("/", func(ctx *gin.Context) {
		ctx.JSON(200, gin.H{
			"code":    0,
			"message": "ok",
		})
	})

	indexCtrl := &controller.IndexController{}
	router.GET("/index", indexCtrl.Index)
	router.GET("/getKey", indexCtrl.GetKey)
	router.GET("/getList", indexCtrl.GetArticleList)
	router.GET("/getListV2", indexCtrl.GetAtricleListForRedis)
	router.POST("/createAuthor", indexCtrl.CreateAuthor)

	articleCtrl := &controller.ArticleController{}
	router.POST("/add", articleCtrl.Add)
	router.POST("/vote", articleCtrl.Vote)
	router.GET("/list", articleCtrl.List)
	router.GET("/groupList", articleCtrl.GroupList)
}
